This repository was archived by the owner on Jan 22, 2025. It is now read-only.
Use retain on Packets instead of creating a new one#5804
Merged
sagar-solana merged 2 commits intosolana-labs:masterfrom Sep 6, 2019
Merged
Use retain on Packets instead of creating a new one#5804sagar-solana merged 2 commits intosolana-labs:masterfrom
sagar-solana merged 2 commits intosolana-labs:masterfrom
Conversation
71554f0 to
eaf3423
Compare
sakridge
previously approved these changes
Sep 5, 2019
Contributor
sakridge
left a comment
There was a problem hiding this comment.
Yea, not too pretty, but seems ok. Better than what is there.
sakridge
reviewed
Sep 5, 2019
| @@ -81,28 +81,49 @@ where | |||
| let now = Instant::now(); | |||
Contributor
There was a problem hiding this comment.
Would be nice to get rid of the packets.packets.append at some point. I don't think we need to copy into a single vec do we?
Codecov Report
@@ Coverage Diff @@
## master #5804 +/- ##
=========================================
- Coverage 75.5% 62.1% -13.4%
=========================================
Files 226 226
Lines 41810 50938 +9128
=========================================
+ Hits 31593 31682 +89
- Misses 10217 19256 +9039 |
Contributor
Author
Pull request has been modified.
227f0bc to
2d315da
Compare
carllin
reviewed
Sep 5, 2019
| // we should be able to automatically drop any packets in the index gaps. | ||
| let mut retain_ix = 0; | ||
| let mut i = 0; | ||
| packets.packets.retain(|_| { |
Contributor
Author
There was a problem hiding this comment.
ask and ye shall receive
2c0f492 to
ba56cf2
Compare
ba56cf2 to
b6272f1
Compare
carllin
reviewed
Sep 6, 2019
carllin
reviewed
Sep 6, 2019
| } | ||
|
|
||
| #[test] | ||
| fn test_recv_window() { |
Contributor
There was a problem hiding this comment.
Does this test the code path where there are bad shreds that actually get filtered out?
Contributor
Author
There was a problem hiding this comment.
yup, see where I add a bunch of Packet::default()s ?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Draining
Packet.packetsand then assigning them to a newPacketswithout a recycler was wastefulSummary of Changes
Collect indices to discard and remove the packets that fail verification.
Unfortunately there doesn't seem to be a pretty way to do this :(